import {reqPhoneCode,reqRegister} from "@/api"
const state={
    code:'',
   
}
const mutations={
    REDPHONECODE(state,code){
        state.code=code
    },
    
}
const actions={
   async getPhoneCode({commit},phone){
        let result =await reqPhoneCode(phone)
        if(result.code==200){
            commit('REDPHONECODE',result.data)
            return "ok"
        }else{
            return Promise.reject(new Error('faile'))
        }
    },
   async getRegister({commit},data){
        let  result = await reqRegister(data)
        console.log(result.data);
        if(result.code==200){
            return "ok"
        }else{
            return Promise.reject(new Error('faile'))
        }
    },
  
}
const getters={}
export  default{
    state,
    mutations,
    actions,
    getters
}